package main

import "fmt"

//测试区块链
func main() {
	//1.创建区块链
	bc:=NewBlockChin()
	//2.添加交易
	bc.AddBlock("sent 1 btc to guoCong")
	bc.AddBlock("sent 2 bto to f")
	//3.区块链浏览器 range
	bci :=bc.NewBlockChainIterator()
	for{
		block,ok :=bci.PrevBlock()
		fmt.Printf("Data:%s\n",block.Data)
		fmt.Printf("Timestamp:%d\n",block.Timestamp)
		fmt.Printf("PrevHash:%d\n",block.PrevHash)
		fmt.Printf("Has:%x\n",block.Hash)
		fmt.Println()
		if !ok{
			break
		}
	}


}

